};
var ModalDialog = GObject.registerClass({
+ Properties: { 'state': GObject.ParamSpec.int('state', 'Dialog state', 'state',
+ GObject.ParamFlags.READABLE,
+ Math.min(...Object.values(State)),
+ Math.max(...Object.values(State)),
+ State.CLOSED) },
Signals: { 'opened': {}, 'closed': {} }
}, class ModalDialog extends St.Widget {
_init(params) {
shouldFadeOut: true,
destroyOnClose: true });
- this.state = State.CLOSED;
+ this._state = State.CLOSED;
this._hasModal = false;
this._actionMode = params.actionMode;
this._shellReactive = params.shellReactive;
this._savedKeyFocus = null;
}
+ get state() {
+ return this._state;
+ }
+
+ _setState(state) {
+ if (this._state == state)
+ return;
+
+ this._state = state;
+ this.notify('state');
+ }
+
clearButtons() {
this.dialogLayout.clearButtons();
}
else
this._monitorConstraint.index = global.display.get_current_monitor();
- this.state = State.OPENING;
+ this._setState(State.OPENING);
this.dialogLayout.opacity = 255;
if (this._lightbox)
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
transition: 'easeOutQuad',
onComplete: () => {
- this.state = State.OPENED;
+ this._setState(State.OPENED);
this.emit('opened');
}
});
}
_closeComplete() {
- this.state = State.CLOSED;
+ this._setState(State.CLOSED);
this.hide();
this.emit('closed');
if (this.state == State.CLOSED || this.state == State.CLOSING)
return;
- this.state = State.CLOSING;
+ this._setState(State.CLOSING);
this.popModal(timestamp);
this._savedKeyFocus = null;
time: FADE_OUT_DIALOG_TIME,
transition: 'easeOutQuad',
onComplete: () => {
- this.state = State.FADED_OUT;
+ this._setState(State.FADED_OUT);
}
});
}